﻿<views:PageBase x:Class="GoG.Client.Views.Pages.SignInPage"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:controls="using:GoG.Client.Controls"
                xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                xmlns:extensions="using:WinRTXamlToolkit.Controls.Extensions"
                xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                xmlns:pages="using:GoG.Client.ViewModels.Pages"
                xmlns:views="using:GoG.Client.Views"
                d:DataContext="{d:DesignInstance pages:SignInPageViewModel,
                                                 IsDesignTimeCreatable=False}"
                mc:Ignorable="d">
    <controls:MasterPage NavigationVisibility="Collapsed" SignInVisibility="Collapsed">
        <controls:MasterPage.Body>
            <Grid />

            <!--  The sign in form.  -->

            <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <TextBlock x:Uid="SignInTextBlock"
                           Grid.Row="0"
                           Grid.Column="1"
                           Margin="0,0,60,8"
                           Foreground="{StaticResource GoGItemForegroundBrush}"
                           Style="{StaticResource PageSubheaderTextStyle}"
                           Text="Sign in to Online-Go.com" />
                <TextBlock x:Uid="PleaseSignInTextBlock"
                           Grid.Row="1"
                           Grid.Column="1"
                           Foreground="{StaticResource GoGItemForegroundBrush}"
                           Style="{StaticResource ItemTextStyle}"
                           Text="Please sign in."
                           TextWrapping="Wrap" />
                <TextBox x:Uid="Username"
                         x:Name="Username"
                         Grid.Row="2"
                         Grid.Column="1"
                         Margin="0,10,0,0"
                         AutomationProperties.AutomationId="UserNameTextBox"
                         AutomationProperties.IsRequiredForForm="True"
                         Header="User Id"
                         IsEnabled="{Binding IsBusy,
                                             Converter={StaticResource BooleanNegationToVisibilityConverter}}"
                         Text="{Binding UserName,
                                        Mode=TwoWay}" />
                <PasswordBox x:Uid="PasswordBox"
                             x:Name="PasswordBox"
                             Grid.Row="3"
                             Grid.Column="1"
                             Margin="0,5,0,0"
                             AutomationProperties.AutomationId="PasswordBox"
                             AutomationProperties.IsRequiredForForm="True"
                             Header="Application Specific Password"
                             IsEnabled="{Binding IsBusy,
                                                 Converter={StaticResource BooleanNegationToVisibilityConverter}}"
                             IsPasswordRevealButtonEnabled="True"
                             Password="{Binding Password,
                                                Mode=TwoWay}"
                             RenderTransformOrigin="0.5,0.5">
                    <PasswordBox.RenderTransform>
                        <CompositeTransform />
                    </PasswordBox.RenderTransform>
                    <PasswordBox.Resources>
                        <Storyboard x:Key="ShakePasswordStoryboard" TargetProperty="UIElement.RenderTransform.Rotation">
                            <DoubleAnimation AutoReverse="True"
                                             Duration="0:0:0.05"
                                             FillBehavior="Stop"
                                             From="-4"
                                             RepeatBehavior="3x"
                                             To="4" />
                        </Storyboard>
                    </PasswordBox.Resources>
                </PasswordBox>
                <HyperlinkButton Grid.Row="3"
                                 Grid.Column="1"
                                 Margin="0,0,0,0"
                                 HorizontalAlignment="Right"
                                 VerticalAlignment="Top"
                                 AutomationProperties.AutomationId="WhatIsThisLink"
                                 Command="{Binding WhatIsThisCommand}"
                                 IsTabStop="False"
                                 Padding="0,4,0,0"
                                 extensions:FrameworkElementExtensions.SystemCursor="Hand">
                    <TextBlock>
                        <Underline>
                            <Run Text="what is this?" />
                        </Underline>
                    </TextBlock>
                </HyperlinkButton>
                <TextBlock Grid.Row="5"
                           Grid.Column="1"
                           Foreground="Red"
                           Style="{StaticResource BodyTextBlockStyle}"
                           Text="{Binding IsSignInInvalid,
                                          Converter={StaticResource IsSignInInvalidConverter}}"
                           TextWrapping="Wrap" />

                <Button x:Name="SubmitButton"
                        Grid.Row="6"
                        Grid.Column="1"
                        HorizontalAlignment="Right"
                        AutomationProperties.AutomationId="SignInSubmitButton"
                        Background="{StaticResource GoGAccentBrush}"
                        Command="{Binding SignInCommand}"
                        Content="Sign In"
                        Foreground="{StaticResource GoGButtonForegroundBrush}" />
            </Grid>

        </controls:MasterPage.Body>
    </controls:MasterPage>
</views:PageBase>
